#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "changelogdialog.h"

AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
    ui->setupUi(this);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    static const QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace("  ", " 0"), "MMM dd yyyy");
    static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
    ui->lab_buildtime->setText(QString("%1 %2").arg(buildDate.toString("yyyy-MM-dd")).arg(buildTime.toString()));

}

AboutDialog::~AboutDialog()
{
    delete ui;
}

/**
 * @brief   更新记录
 */
void AboutDialog::on_pbt_Changelog_clicked()
{
    ChangelogDialog dlg(this);
    dlg.exec();
}


void AboutDialog::on_pbt_getupdate_clicked()
{
    QDesktopServices::openUrl(QUrl("https://gitee.com/rpdhunter/tetris/releases"));
}

